#ifndef NETWORKFACTORY_H
#define NETWORKFACTORY_H

#include <assert.h>
#include "socket/protocol/Command.h"

#include "cclientlogin.h"
#include "cclientbook.h"
#include "cclientrequestorder.h"
#include "cabandonbook.h"
#include "cgetoncar.h"
#include "cgetoffcar.h"

class INetWorking;

class CNetworkFactory
{
public:
    static INetWorking* getNetworkClass(int command)
    {
        switch (command)
        {
        case protocal::CLI_LOGIN:
            return (new CClientLogin);
            break;

        case protocal::CLI_BOOK:
            return (new CClientBook);
            break;

        case protocal::CLI_CHOOSE_CAR:
            return (new CClientRequestOrder);
            break;

        case protocal::CLI_ABANDON_BOOK:
            return (new CAbandonBook);
            break;

        case protocal::CLI_GET_ON_CAR:
            return (new CGetOnCar);
            break;

        case protocal::CLI_GET_OFF_CAR:
            return (new CGetOffCar);
            break;

        case protocal::CLI_DISCARD_ORDER:
            //return (new CClientBook);
            break;

        default:
            assert(0);
            break;
        }
    }
};

#endif // NETWORKFACTORY_H
